package simco.framework.gui.graph.supp;

/**
 * Vyctovy typ urcujici relativni pozici jednoho objektu v prostoru
 * vuci druhemu. 
 * 
 * @author Matej Prokop, mythge@students.zcu.cz
 */
public enum PositionCoordinates
{
    NORTH, EAST, WEST, SOUTH, NORTH_EAST, NORTH_WEST, SOUTH_EAST, SOUTH_WEST, SAME_PLACE;

    /*
     * Ohodnoceni bodu z pohledu Cohen-Sutherlandova algoritmu
     */
    public static final int N = 100;
    public static final int E = 10;
    public static final int S = 1000;
    public static final int W = 1;

    private static final int NE = 110;
    private static final int NW = 101;
    private static final int SE = 1010;
    private static final int SW = 1001;

    /**
     * Vraci relativni polohu pro cislo kodujici poloho z pohledu
     * Cohen-Sutherlandova algoritmu
     * 
     * @param cohenId kod pozice z pohledu Cohen-Sutherlandova algoritmu
     * @return relativni poloha objektu urcena vyctovym typem
     */
    public static PositionCoordinates getCordByCohen(int cohenId)
    {
        switch(cohenId)
        {
            case N: return NORTH;
            case E: return EAST;
            case S: return SOUTH;
            case W: return WEST;
            case NE: return NORTH_EAST;
            case NW: return NORTH_WEST;
            case SE: return SOUTH_EAST;
            case SW: return SOUTH_WEST;
            default: return SAME_PLACE;
        }
    }
}
